import {defineConfig} from 'vite'
import path from 'path'
import vue from '@vitejs/plugin-vue'
import Components from 'unplugin-vue-components/vite'
import {ElementPlusResolver} from 'unplugin-vue-components/resolvers'
import ElementPlus from 'unplugin-element-plus/vite'

// https://vite.dev/config/
export default defineConfig({
    base: './',
    resolve: {
        alias: {
            '~/': `${path.resolve(__dirname, 'src')}/`,
            'vue': 'vue/dist/vue.esm-bundler.js',
        },
    },
    css: {
        preprocessorOptions: {
            scss: {
                additionalData: `@use "~/assets/styles/element/index.scss" as *;`,
            },
        },
    },
    plugins: [
        vue(),
        Components({
            resolvers: [ElementPlusResolver({
                importStyle: "sass",
                // directives: true,
                // version: "2.1.5",
            })],
        }),
        ElementPlus({
            // options
            useSource: true,
        }),
    ],
    server: {
        host: '0.0.0.0',
        port: 5175,
        proxy: {
            '/ai-repost': {
                // target: 'http://115.190.9.96',
                target: 'http://localhost:6889',
                changeOrigin: true
            },
        },
    },
})
